<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent jy-style-height border-hover-style outline-style2">
    <div class="Showroom-parent" v-if="props.info.digitalShowroom">
      <digitalShowroomIcon :url="props.info.digitalShowroom" :id="props.info.id" />
    </div>
    <div
      class="outline-parent-bg"
      :style="{
        backgroundImage:
          props.info.subTitle || props.info.value || props.info.remarks
            ? `url(${publicUrls + 'free/style4/Level1outlineStyle6Bg.webp'})`
            : `url(${publicUrls + 'free/style4/Level1outlineStyle6-2Bg.webp'})`,
      }"
    >
      <div class="title-box" v-if="props.info.text">
        <p class="title-name">{{ props.info.text }}</p>
      </div>
      <div
        class="content-box"
        :class="{
          'content-box2': props.info.subTitle && !props.info.value && props.info.remarks,
          'content-box3':
            (!props.info.subTitle && !props.info.value && props.info.remarks) ||
            (props.info.subTitle && !props.info.value && !props.info.remarks) ||
            (!props.info.subTitle && props.info.value && !props.info.remarks),
          'content-box4': props.info.subTitle && props.info.value && !props.info.remarks,
        }"
        v-if="props.info.subTitle || props.info.value || props.info.remarks"
      >
        <p class="sub-title" v-if="props.info.subTitle">{{ props.info.subTitle }}</p>
        <div
          class="cover"
          @click="ImgVisible = true"
          v-if="props.info.value"
          :class="{
            cover2: !props.info.remarks,
            cover3: !props.info.subTitle,
            cover4: !props.info.remarks && !props.info.subTitle,
          }"
        >
          <img class="cover-img" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
        </div>
        <div class="remarks1" v-if="props.info.remarks">
          <TextMax
            :data="props.info.remarks"
            :infoData="props.info"
            :title="props.info.text"
            :row="props.info.value ? 3 : 9"
          ></TextMax>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
export default defineComponent({
  name: 'free4style6',
});
</script>
<script lang="ts" setup>
import { publicUrls, textType } from '@/utils/minxin';
import { getTextHtml } from '@/utils/minxin';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax.vue';
import { useProjectStore } from '@/store';
import digitalShowroomIcon from '@/freeComponents/unitdigitalShowroom/style4.vue';

const ImgVisible = ref(false);
const store = useProjectStore();

const props = defineProps({
  info: {
    type: Object,
  },
});

// 跳转全景链接
const open = (url: any) => {
  if (url) {
    window.open(url, '_blank');
  }
};
</script>

<style lang="less" scoped>
.outline-parent {
  position: relative;
  margin-right: 90px;
  margin-top: 0;
  margin-left: 120px;
}
.Showroom-parent {
  position: absolute;
  top: 48px;
  right: 52px;
  z-index: 21;
}
.outline-parent-bg {
  width: 571px;
  height: 100%;
  position: relative;
  z-index: 20;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.title-box {
  position: absolute;
  top: 59px;
  left: 20px;
  width: 155px;
  height: 550px;
  display: flex;
  align-items: center;
  justify-content: center;
  .title-name {
    flex-shrink: 0;
    width: 64px;
    height: 256px;
    color: #5391a3;
    text-align: center;
    font-family: 'SourceHanSerifCN';
    font-size: 30px;
    font-style: normal;
    font-weight: 700;
    line-height: 32px; /* 106.667% */
    writing-mode: vertical-lr;
    text-orientation: upright;
    letter-spacing: 2px;
  }
}
.content-box {
  position: absolute;
  top: 214px;
  right: 55px;
  width: 289px;
  height: 478px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 27px 0 58px 0;
}
.content-box2 {
  padding: 50px 0 58px 0;
}
.content-box3 {
  padding: 0;
  justify-content: center;
  .remarks1 {
    margin: 0;
  }
  .cover {
    margin: 0;
  }
}
.content-box4 {
  padding: 53px 0 60px 0;
}
.sub-title {
  flex-shrink: 0;
  width: 270px;
  color: #333;
  text-align: center;
  font-family: 'PingFang SC';
  font-size: 18px;
  font-style: normal;
  font-weight: 400;
  line-height: 28px; /* 155.556% */
  opacity: 0.8;
}
.cover {
  width: 270px;
  height: 198px;
  flex-shrink: 0;
  background: #e3eeed;
  overflow: hidden;
  margin-top: 20px;
  .cover-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.5s;
  }
  &:hover {
    .cover-img {
      transform: scale(1.2);
    }
  }
}
.cover2 {
  height: 285px;
}
.cover3 {
  height: 278px;
  margin: 0;
}
.cover4 {
  height: 300px;
}
.remarks1 {
  flex-shrink: 0;
  width: 258px;
  margin-top: 20px;
}
::v-deep .van-text-ellipsis {
  color: rgba(51, 51, 51, 0.8) !important;
  font-family: 'PingFang SC' !important;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 400;
  line-height: 32px; /* 200% */
  opacity: 0.8;
}
::v-deep .van-text-ellipsis__action::before {
  color: #83b0b3 !important;
  font-family: 'PingFang SC' !important;
  font-size: 16px !important;
  font-style: normal;
  font-weight: 500;
  line-height: 32px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
</style>
